package com.cyandpos.pad.refund.adapter;

import android.content.Context;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.cyandpos.pad.R;
import com.cyandpos.pad.activity.RefundActivity;
import com.cyandpos.pad.posdata.Payment;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class RefundPaymentAdapter extends RecyclerView.Adapter<RefundPaymentAdapter.GoodsHolderr>  {

    private LayoutInflater mLayoutInflater;
    private List<Payment> mDatas;
    private RefundActivity mContext;
    private boolean isOrder;
    public RefundPaymentAdapter(Context context, List<Payment> payments) {
        mContext = (RefundActivity) context;
        this.mDatas = payments;
        mLayoutInflater = LayoutInflater.from(mContext);
    }
    @Override
    public GoodsHolderr onCreateViewHolder(ViewGroup parent, int viewType) {
        return new GoodsHolderr(mLayoutInflater.inflate(R.layout.list_refund_item, parent, false));
    }

    @Override
    public void onBindViewHolder(GoodsHolderr holder,final int position) {
        holder.mGood_xh.setText(position + 1 + "");
        holder.mGoodName.setText(mDatas.get(position).getPayName());
        holder.mGoodCount.setText(mDatas.get(position).getPayAmount());
        holder.mGoodCode.setVisibility(View.GONE);
        holder.mGoodPrice.setVisibility(View.GONE);
        holder.mIvLeftSj.setVisibility(View.GONE);
        holder.mIvRightSj.setVisibility(View.GONE);
        holder.mYH.setVisibility(View.GONE);
        holder.mMoney.setVisibility(View.GONE);

    }

    @Override
    public int getItemCount() {
        return mDatas.size();
    }

    class GoodsHolderr extends RecyclerView.ViewHolder {
        @BindView(R.id.good_xh)
        TextView mGood_xh;
        @BindView(R.id.good_name)
        TextView mGoodName;
        @BindView(R.id.good_count)
        TextView mGoodCount;
        @BindView(R.id.tv_sale_good_code)
        TextView mGoodCode;
        @BindView(R.id.good_price)
        TextView mGoodPrice;
        @BindView(R.id.YH)
        TextView mYH;
        @BindView(R.id.money)
        TextView mMoney;
        @BindView(R.id.img_sale_goods_cut)
        ImageView mIvLeftSj;
        //        @BindView(R.id.refund_count)
//        TextView mRefundCount;
        @BindView(R.id.img_sale_goods_add)
        ImageView mIvRightSj;
//        @BindView(R.id.discount)
//        TextView mDiscount;


        public GoodsHolderr(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
